<?php
	/**
	* @author trungdt 
	* @since Nov 3, 2011
	* 
	* Change logs
	* 
	*/
	if (!defined("EXPONENT")) exit("");

	$item = null;
	if (isset($_POST['id'])) {
		$item = $db->selectObject("requestmodule_request","id=".intval($_POST['id']));
		$loc = unserialize($item->location_data);
		if (exponent_permissions_check(array("administrate", "approve"),$loc) && isset($_REQUEST['approve']))
		{
			$approve=intval($_REQUEST['approve']);
			$approve_reason=_ab_safe_html_string($_REQUEST['approve_reason']);
			if ($approve >= 0 && $approve <= 2)
			{
				$item->approve=$approve;
				$item->approve_name="{$user->firstname} {$user->lastname}({$user->username})";
				$item->approve_date=aboid_getCurrentTime();
				$item->not_approve_reason=$approve_reason;
				$db->updateObject($item,"requestmodule_request");
			}
		}
	}
	echo "OK";
	exponent_theme_setFlagAjaxAction(true);
?>
